package com.lu.sb210207.advice;

import com.lu.sb210207.exception.ScheduleException;
import com.lu.sb210207.result.JsonResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionHandlerAdvice {

    @ExceptionHandler(ScheduleException.class)
    public Object exceptionHandler(RuntimeException e) {
        return JsonResult.builder().code(400).msg(e.getMessage()).build();
    }

}
